import 'package:eh_mobile/pages/index.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'index.dart';

class WelcomePage extends GetView<WelcomeController> {
  const WelcomePage({Key? key}) : super(key: key);

  // 主视图
  Widget _buildView() {
    return Center(
        child: OutlinedButton.icon(
            onPressed: () {
              Get.to(HomepagePage());
            },
            icon: const Icon(
              Icons.face,
              weight: 10,
            ),
            label: const Text(
              '进入首页',
              textAlign: TextAlign.center,
              style: TextStyle(
                fontSize: 14,
                color: Color(0xFF303133),
              ),
            )));
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<WelcomeController>(
      init: WelcomeController(),
      id: "welcome",
      builder: (_) {
        return Scaffold(
          appBar: AppBar(title: const Text("首次进入欢迎页")),
          body: SafeArea(
            child: _buildView(),
          ),
        );
      },
    );
  }
}
